package com.saihai.jiankang.ufSsrwLog.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.saihai.common.annotation.Log;
import com.saihai.common.core.controller.BaseController;
import com.saihai.common.core.domain.AjaxResult;
import com.saihai.common.enums.BusinessType;
import com.saihai.jiankang.ufSsrwLog.domain.UfSsrwLog;
import com.saihai.jiankang.ufSsrwLog.service.IUfSsrwLogService;
import com.saihai.common.utils.poi.ExcelUtil;
import com.saihai.common.core.page.TableDataInfo;

/**
 * 体检记录Controller
 * 
 * @author ruoyi
 * @date 2024-07-18
 */
@RestController
@RequestMapping("/jiankang/ufSsrwLog")
public class UfSsrwLogController extends BaseController
{
    @Autowired
    private IUfSsrwLogService ufSsrwLogService;

    /**
     * 查询体检记录列表
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufSsrwLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(UfSsrwLog ufSsrwLog)
    {
        startPage();
        List<UfSsrwLog> list = ufSsrwLogService.selectUfSsrwLogList(ufSsrwLog);
        return getDataTable(list);
    }

    /**
     * 导出体检记录列表
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufSsrwLog:export')")
    @Log(title = "体检记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, UfSsrwLog ufSsrwLog)
    {
        List<UfSsrwLog> list = ufSsrwLogService.selectUfSsrwLogList(ufSsrwLog);
        ExcelUtil<UfSsrwLog> util = new ExcelUtil<UfSsrwLog>(UfSsrwLog.class);
        util.exportExcel(response, list, "体检记录数据");
    }

    /**
     * 获取体检记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufSsrwLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ufSsrwLogService.selectUfSsrwLogById(id));
    }

    /**
     * 新增体检记录
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufSsrwLog:add')")
    @Log(title = "体检记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody UfSsrwLog ufSsrwLog)
    {
        return toAjax(ufSsrwLogService.insertUfSsrwLog(ufSsrwLog));
    }

    /**
     * 修改体检记录
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufSsrwLog:edit')")
    @Log(title = "体检记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody UfSsrwLog ufSsrwLog)
    {
        return toAjax(ufSsrwLogService.updateUfSsrwLog(ufSsrwLog));
    }

    /**
     * 删除体检记录
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufSsrwLog:remove')")
    @Log(title = "体检记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ufSsrwLogService.deleteUfSsrwLogByIds(ids));
    }
}
